package com.nanhai.buddhist.college.module.collegebase.dal.mysql.accommodationbed;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.collegebase.dal.dataobject.accommodationbed.AccommodationBedDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.collegebase.controller.admin.accommodationbed.vo.*;

/**
 * 床铺 Mapper
 *
 * @author AKai
 */
@Mapper
public interface AccommodationBedMapper extends BaseMapperX<AccommodationBedDO> {

    default PageResult<AccommodationBedDO> selectPage(AccommodationBedPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccommodationBedDO>()
                .eqIfPresent(AccommodationBedDO::getRoomId, reqVO.getRoomId())
                .likeIfPresent(AccommodationBedDO::getBedName, reqVO.getBedName())
                .eqIfPresent(AccommodationBedDO::getBedType, reqVO.getBedType())
                .orderByDesc(AccommodationBedDO::getCreateTime));
    }

    default List<AccommodationBedDO> selectList(AccommodationBedExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AccommodationBedDO>()
                .eqIfPresent(AccommodationBedDO::getRoomId, reqVO.getRoomId())
                .likeIfPresent(AccommodationBedDO::getBedName, reqVO.getBedName())
                .eqIfPresent(AccommodationBedDO::getBedType, reqVO.getBedType())
                .orderByDesc(AccommodationBedDO::getCreateTime));
    }

}
